<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理员控制台 - 银行管理系统</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
    <style>
        body {
            font-family: "Microsoft YaHei", sans-serif;
            background-color: #f5f5f5;
        }
        .main-container {
            display: flex;
            min-height: 100vh;
        }
        .sidebar {
            width: 250px;
            background-color: #0d47a1;
            color: #fff;
            padding-top: 20px;
        }
        .sidebar .nav-link {
            color: #fff;
            padding: 10px 20px;
            border-left: 3px solid transparent;
        }
        .sidebar .nav-link:hover {
            background-color: #1565c0;
            border-left: 3px solid #fff;
        }
        .sidebar .nav-link.active {
            background-color: #1976d2;
            border-left: 3px solid #fff;
        }
        .sidebar .nav-link i {
            margin-right: 10px;
        }
        .content {
            flex: 1;
            padding: 20px;
            background-color: #fff;
        }
        .header {
            background-color: #1976d2;
            color: #fff;
            padding: 15px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .header h1 {
            margin: 0;
            font-size: 1.5rem;
        }
        .card {
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
        }
        .card-header {
            background-color: #1976d2;
            color: #fff;
            border-radius: 8px 8px 0 0 !important;
        }
    </style>
</head>
<body>
<div class="main-container">
    <div class="sidebar">
        <div class="text-center mb-4">
            <h3>银行管理系统</h3>
        </div>
        <ul class="nav flex-column">
            <li class="nav-item">
                <a class="nav-link active" href="/admin/index">
                    <i class="fa fa-dashboard"></i> 控制台
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/admin/user/page">
                    <i class="fa fa-users"></i> 客户管理
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/admin/card/page">
                    <i class="fa fa-credit-card"></i> 银行卡管理
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/admin/deposit/page">
                    <i class="fa fa-money"></i> 存款业务管理
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/admin/trade/page">
                    <i class="fa fa-exchange"></i> 交易管理
                </a>
            </li>
            <li class="nav-item mt-5">
                <a class="nav-link" href="/">
                    <i class="fa fa-sign-out"></i> 退出系统
                </a>
            </li>
        </ul>
    </div>

    <div class="flex-grow-1 d-flex flex-column">
        <div class="header">
            <h1>管理员控制台</h1>
            <div class="d-flex align-items-center">
                <span>欢迎，管理员</span>
            </div>
        </div>

        <div class="content">
            <div id="alertContainer"></div>

            <div class="row">
                <div class="col-md-3">
                    <div class="card bg-primary text-white">
                        <div class="card-body">
                            <h5 class="card-title">客户总数</h5>
                            <h2 class="card-text" th:text="${userCount}"></h2>
                            <a href="/admin/user/page" class="text-white">查看详情 <i class="fa fa-arrow-right"></i></a>
                        </div>
                    </div>
                </div>

                <div class="col-md-3">
                    <div class="card bg-success text-white">
                        <div class="card-body">
                            <h5 class="card-title">银行卡总数</h5>
                            <h2 class="card-text" th:text="${cardCount}"></h2>
                            <a href="/admin/card/page" class="text-white">查看详情 <i class="fa fa-arrow-right"></i></a>
                        </div>
                    </div>
                </div>

                <div class="col-md-3">
                    <div class="card bg-info text-white">
                        <div class="card-body">
                            <h5 class="card-title">存款业务数</h5>
                            <h2 class="card-text" th:text="${depositCount}"></h2>
                            <a href="/admin/deposit/page" class="text-white">查看详情 <i class="fa fa-arrow-right"></i></a>
                        </div>
                    </div>
                </div>

                <div class="col-md-3">
                    <div class="card bg-warning text-white">
                        <div class="card-body">
                            <h5 class="card-title">交易总数</h5>
                            <h2 class="card-text" th:text="${tradeCount}"></h2>
                            <a href="/admin/trade/page" class="text-white">查看详情 <i class="fa fa-arrow-right"></i></a>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row mt-4">
                <div class="col-md-6">
                    <div class="card">
                        <div class="card-header">
                            <h5 class="mb-0">最近交易记录</h5>
                        </div>
                        <div class="card-body">
                            <table class="table table-bordered table-striped">
                                <thead>
                                <tr>
                                    <th>交易时间</th>
                                    <th>卡号</th>
                                    <th>交易类型</th>
                                    <th>交易金额</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr th:if="${#lists.isEmpty(recentTrades)}">
                                    <td colspan="4" class="text-center">暂无交易记录</td>
                                </tr>
                                <tr th:each="trade : ${recentTrades}">
                                    <td th:text="${#dates.format(trade.tradeDate, 'yyyy-MM-dd HH:mm:ss')}">2023-06-01 10:30:00</td>
                                    <td th:text="${trade.cardId}">6222021234567890</td>
                                    <td th:text="${trade.tradeType}">存款</td>
                                    <td th:text="${#numbers.formatDecimal(trade.tradeMoney, 1, 2)}">500.00</td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

                <div class="col-md-6">
                    <div class="card">
                        <div class="card-header">
                            <h5 class="mb-0">系统信息</h5>
                        </div>
                        <div class="card-body">
                            <ul class="list-group">
                                <li class="list-group-item d-flex justify-content-between align-items-center">
                                    系统名称
                                    <span>银行管理系统</span>
                                </li>
                                <li class="list-group-item d-flex justify-content-between align-items-center">
                                    版本号
                                    <span>v1.0.0</span>
                                </li>
                                <li class="list-group-item d-flex justify-content-between align-items-center">
                                    开发框架
                                    <span>Spring Boot 2.7.5</span>
                                </li>
                                <li class="list-group-item d-flex justify-content-between align-items-center">
                                    数据库
                                    <span>MySQL 8.0</span>
                                </li>
                                <li class="list-group-item d-flex justify-content-between align-items-center">
                                    服务器时间
                                    <span th:text="${#dates.format(#dates.createNow(), 'yyyy-MM-dd HH:mm:ss')}">2023-06-01 15:30:00</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
    // 通用提示框
    function showAlert(message, type) {
        const alertDiv = $('<div class="alert alert-' + type + ' alert-dismissible fade show" role="alert">' +
            message +
            '<button type="button" class="close" data-dismiss="alert" aria-label="Close">' +
            '<span aria-hidden="true">&times;</span>' +
            '</button>' +
            '</div>');

        $('#alertContainer').append(alertDiv);

        setTimeout(function() {
            alertDiv.alert('close');
        }, 3000);
    }
</script>
</body>
</html> 